package LeetCode;

public class LC_518_CoinChange2 {
    public static void main(String[] args) {

    }

    public class Solution {
        public int change(int amount, int[] coins) {
            int[] table = new int[amount + 1];
            table[0] = 1;
            for (int temp : coins) {
                for (int j = 0; j < amount + 1; j++) {
                    if (j - temp >= 0) {
                        table[j] += table[j - temp];
                    }
                }
            }
            return table[amount];
        }

    }
}
